#include "multi_button.h"
#include "typedefs.h"
#include "softTimer.h"



static struct Timer timer1;
static struct Timer timer2;

static void timer1_callback();
static void timer2_callback();

//------------------------------------------------
__IO u8 itick=0;
__IO u8 itimer=0;
__IO u8 itimer_1s=0;





/* 
10ms
 */
void timer1_callback()
{
	button_ticks();
	
//----------------------------
	itick++;
	if(10 ==itick)//10*10=100ms
	{
		itick=0;
		if(itimer_1s++ >5)//5*100=500ms
		{
			itimer_1s=0;
			SetBit(itimer,Bit0);//DMX512

		}
	}
	
//----------------------------

}
//------------------------------------------------
void timer2_callback()
{

	
} 
//------------------------------------------------

void Init_softTimer()
{

	timer_init(&timer1, timer1_callback, 10,10); //10ms loop周期
    timer_start(&timer1);
    
    // timer_init(&timer2, timer2_callback, 1, 1); //1ms 周期
    // timer_start(&timer2);

}
//---------------------------------

void Timer_CLR(u8 itimer_bit)
{
	ClrBit(itimer,itimer_bit);
}
bool Timer_GET(u8 itimer_bit)
{
	return GetBit(itimer,itimer_bit);
}

//---------------------------------

//---------------------------------

